﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;
    using System.Xml;

    [ScriptType("SP.GroupCreationInformation", ValueObject=true, ServerTypeId="{9fd1540e-59e6-47fa-9a00-5173c9c35785}")]
    public sealed class GroupCreationInformation : ClientValueObject
    {
        private string m_description;
        private string m_title;

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = false;
            string str = peekedName;
            if (str != null)
            {
                if (!(str == "Title"))
                {
                    if (str == "Description")
                    {
                        flag = true;
                        reader.ReadName();
                        this.m_description = reader.ReadString();
                    }
                    return flag;
                }
                flag = true;
                reader.ReadName();
                this.m_title = reader.ReadString();
            }
            return flag;
        }

        [EditorBrowsable(EditorBrowsableState.Never)]
        public override void WriteToXml(XmlWriter writer, SerializationContext serializationContext)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (serializationContext == null)
            {
                throw new ArgumentNullException("serializationContext");
            }
            writer.WriteStartElement("Property");
            writer.WriteAttributeString("Name", "Title");
            DataConvert.WriteValueToXmlElement(writer, this.Title, serializationContext);
            writer.WriteEndElement();
            writer.WriteStartElement("Property");
            writer.WriteAttributeString("Name", "Description");
            DataConvert.WriteValueToXmlElement(writer, this.Description, serializationContext);
            writer.WriteEndElement();
        }

        [Remote]
        public string Description
        {
            get
            {
                return this.m_description;
            }
            set
            {
                this.m_description = value;
            }
        }

        [Remote]
        public string Title
        {
            get
            {
                return this.m_title;
            }
            set
            {
                this.m_title = value;
            }
        }

        [EditorBrowsable(EditorBrowsableState.Never)]
        public override string TypeId
        {
            get
            {
                return "{9fd1540e-59e6-47fa-9a00-5173c9c35785}";
            }
        }
    }
}

